﻿namespace OpenPms.Services;

public partial class OrderService
{
    public Task<List<VRoom>> GetAvailableRoomsAsync(int hotelId,Guid roomTypeId,int quantity) => db.Rooms.Where(ii => ii.HotelId == hotelId && ii.RoomTypeId == roomTypeId && ii.RoomStatus == ERoomStatus.空).OrderBy(ii => ii.IsDirty).Select(ii => new VRoom() { RoomNo = ii.RoomNo, RoomStatus = ii.RoomStatus }).Take(quantity).ToListAsync();
    public async Task<VRoom> QueryRoomStatusAsync(int hotelId, string roomNo)
    {
        return await db.Rooms.Where(ii => ii.HotelId == hotelId && ii.RoomNo == roomNo).Select(ii => new VRoom() { RoomId = ii.Id, RoomNo = ii.RoomNo, RoomStatus = ii.RoomStatus, IsDirty = ii.IsDirty }).FirstAsync();
    }

}
